# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=malybuzz
pkgver=1.0
pkgrel=4
groups=('blackarch' 'blackarch-fuzzer')
pkgdesc='A Python tool focused in discovering programming faults in network software.'
arch=('any')
url='http://eternal-todo.com/tools/malybuzz-network-fuzzer'
license=('BSD')
depends=('python2' 'python2-lxml')
makedepends=('git')
source=("http://downloads.sourceforge.net/project/$pkgname/Malybuzz/Malybuzz%20Beta%201.0/Malybuzz_Beta_$pkgver.tar.gz")
sha512sums=('665bb16ba46741d135c07a778e72acb3d4f7f73dbf2c86d5947bb63ff396af6dc84dfc1289a0ced247a4006d98a01ac796cfcb210d3c059e67468e6647e8d64b')

prepare() {
  cd Malybuzz

  find . -type f -name '*.py' -exec chmod 644 {} +
  find . -type f -name '*.pyc' -exec rm {} +
}

package() {
  cd Malybuzz

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname" AUTHORS THANKS TODO FAQ
  install -Dm 644 COPYING "$pkgdir/usr/share/licenses/malybuzz/COPYING"

  rm AUTHORS THANKS TODO FAQ COPYING

  cp -a * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python2 Malybuzz.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

